package main

import (
	"fmt"
)

func test(x map[int]int){
	x[10]=88888
}

type Stu struct{
	Name string 
	Age int 
	Address string
}

func main(){


	//map 确实是引用类型
	s:=make(map[int]int )
	s[0]=10
	s[1]=20
	s[10]=30

	test(s)

	fmt.Println(s)

	x:=make(map[int][2]string)

	x[0]=[...]string{"china","korean"}
	//x[1][0]="beijing";
	//x[1][1]="shanghai"
	x[1]=[2]string{"bj","sr"}
	var k [2]string 
	k[0]="东方"
	k[1]="西方"
	x[2]=k

	fmt.Println(x)

	fmt.Println(x[1][0])
	//x[1][0]="北京"
	fmt.Println(x[1][0])

	j:=[...]string{"bj","sh"}
	j[0]="北京"

	fmt.Println(j)

	fmt.Println("*******************")

	student:=make(map[string]Stu,10)

	stu1:=Stu{"jack",100,"beijing"}
	stu2:=Stu{"tom",200,"shanghai"}

	student["no1"]=stu1
	student["no2"]=stu2

	fmt.Println(student)

	for k,v:=range student{

		fmt.Printf("编号为：%v\n",k)
		fmt.Printf("名字为:%v\n",v.Name)
		fmt.Printf("年龄为:%v\n",v.Age)
		fmt.Printf("地址为:%v\n",v.Address)
	}
}